ALMaSS  1.0
The Animal, Landscape and Man Simulation System
SimplePositionMap Class Reference

Used to map locations of individuals for density estimates - space inefficient but good for testing. More...

#include <positionmap.h>

Inheritance diagram for SimplePositionMap:
ScalablePositionMap

Public Member Functions

virtual bool GetMapValue (unsigned a_x, unsigned a_y)
 
virtual void SetMapValue (unsigned a_x, unsigned a_y)
 
virtual void ClearMapValue (unsigned a_x, unsigned a_y)
 
virtual int GetMapDensity (unsigned a_x, unsigned a_y, unsigned a_range)
 
virtual bool GetMapPositive (unsigned a_x, unsigned a_y, unsigned a_range)
 
 SimplePositionMap ()
 
 SimplePositionMap (unsigned a_size)
 
 SimplePositionMap (Landscape *L)
 
virtual ~SimplePositionMap ()
 

Public Attributes

bool * m_TheMap
 
unsigned int m_maxx
 
unsigned int m_maxy
 

Detailed Description

Used to map locations of individuals for density estimates - space inefficient but good for testing.

Constructor & Destructor Documentation

◆ SimplePositionMap() [1/3]

SimplePositionMap::SimplePositionMap ( )
57 {
58  ;// Default do nothing constructor
59 }

◆ SimplePositionMap() [2/3]

SimplePositionMap::SimplePositionMap ( unsigned  a_size)
78 {
79  m_maxx=a_size;
80  m_maxy=m_maxx;
81  m_TheMap = new bool[ m_maxx*m_maxy ];
82  for (unsigned y=0; y<m_maxy; y++)
83  {
84  for (unsigned x=0; x<m_maxx; x++)
85  {
86  ClearMapValue(x,y);
87  }
88  }
89 }
unsigned int m_maxx
Definition: positionmap.h:50
bool * m_TheMap
Definition: positionmap.h:49
unsigned int m_maxy
Definition: positionmap.h:50
virtual void ClearMapValue(unsigned a_x, unsigned a_y)
Definition: positionmap.h:61

References ClearMapValue(), m_maxx, m_maxy, and m_TheMap.

◆ SimplePositionMap() [3/3]

SimplePositionMap::SimplePositionMap ( Landscape L)
63 {
66  m_TheMap = new bool[ m_maxx*m_maxy ];
67  for (unsigned y=0; y<m_maxy; y++)
68  {
69  for (unsigned x=0; x<m_maxx; x++)
70  {
71  ClearMapValue(x,y);
72  }
73  }
74 }
int SupplySimAreaHeight(void)
Definition: landscape.h:1637
int SupplySimAreaWidth(void)
Definition: landscape.h:1632

References ClearMapValue(), m_maxx, m_maxy, m_TheMap, Landscape::SupplySimAreaHeight(), and Landscape::SupplySimAreaWidth().

◆ ~SimplePositionMap()

SimplePositionMap::~SimplePositionMap ( )
virtual
93 {
94  delete m_TheMap;
95 }

References m_TheMap.

Member Function Documentation

◆ ClearMapValue()

virtual void SimplePositionMap::ClearMapValue ( unsigned  a_x,
unsigned  a_y 
)
inlinevirtual

◆ GetMapDensity()

virtual int SimplePositionMap::GetMapDensity ( unsigned  a_x,
unsigned  a_y,
unsigned  a_range 
)
inlinevirtual

Reimplemented in ScalablePositionMap.

67  {
68  int dens=0;
69  for (unsigned x = a_x; x<a_x+a_range; x++)
70  {
71  for (unsigned y = a_y; y<a_y+a_range; y++)
72  if (m_TheMap[x+y*m_maxx]) dens++;
73  }
74  return dens;
75  }

References m_maxx, and m_TheMap.

Referenced by Bembidion_Adult::DDepMort(), and Bembidion_Larvae::st_Develop().

◆ GetMapPositive()

virtual bool SimplePositionMap::GetMapPositive ( unsigned  a_x,
unsigned  a_y,
unsigned  a_range 
)
inlinevirtual

Reimplemented in ScalablePositionMap.

77  {
78  for (unsigned x = a_x; x<a_x+a_range; x++)
79  {
80  for (unsigned y = a_y; y<a_y+a_range; y++)
81  if (m_TheMap[x+y*m_maxx]) return true;
82  }
83  return false;
84  }

References m_maxx, and m_TheMap.

◆ GetMapValue()

virtual bool SimplePositionMap::GetMapValue ( unsigned  a_x,
unsigned  a_y 
)
inlinevirtual

Reimplemented in ScalablePositionMap.

52  {
53  return m_TheMap[a_x+a_y*m_maxx];
54  }

References m_maxx, and m_TheMap.

Referenced by Bembidion_Population_Manager::CreateObjects(), and Bembidion_Adult::MoveTo_quality_assess().

◆ SetMapValue()

virtual void SimplePositionMap::SetMapValue ( unsigned  a_x,
unsigned  a_y 
)
inlinevirtual

Reimplemented in ScalablePositionMap.

57  {
58  m_TheMap[a_x+a_y*m_maxx]=true;
59  }

References m_maxx, and m_TheMap.

Referenced by Bembidion_Population_Manager::CreateObjects(), Bembidion_Adult::MoveTo(), and Bembidion_Adult::MoveToAggr().

Member Data Documentation

◆ m_maxx

◆ m_maxy

unsigned int SimplePositionMap::m_maxy

◆ m_TheMap


The documentation for this class was generated from the following files: